<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>evaluating-the-linear-regression-model | 绿萝间</title>
<link href="../assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
<link href="../assets/css/ipython.min.css" rel="stylesheet" type="text/css">
<link href="../assets/css/nikola_ipython.css" rel="stylesheet" type="text/css">
<meta name="theme-color" content="#5670d4">
<meta name="generator" content="Nikola (getnikola.com)">
<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
<link rel="canonical" href="https://muxuezi.github.io/posts/evaluating-the-linear-regression-model.html">
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: true
    },
    displayAlign: 'center', // Change this to 'center' to center equations.
    "HTML-CSS": {
        styles: {'.MathJax_Display': {"margin": 0}}
    }
});
</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Tao Junjie">
<link rel="prev" href="fitting-a-line-through-data.html" title="fitting-a-line-through-data" type="text/html">
<link rel="next" href="directly-applying-bayesian-ridge-regression.html" title="directly-applying-bayesian-ridge-regression" type="text/html">
<meta property="og:site_name" content="绿萝间">
<meta property="og:title" content="evaluating-the-linear-regression-model">
<meta property="og:url" content="https://muxuezi.github.io/posts/evaluating-the-linear-regression-model.html">
<meta property="og:description" content="评估线性回归模型¶








在这个主题中，我们将介绍回归模型拟合数据的效果。上一个主题我们拟合了数据，但是并没太关注拟合的效果。每当拟合工作做完之后，我们应该问的第一个问题就是“拟合的效果如何？”本主题将回答这个问题。









Getting ready¶








我们还用上一主题里的lr对象和boston数据集。lr对象已经拟合过数据，现在有许多方法可以用。





">
<meta property="og:type" content="article">
<meta property="article:published_time" content="2015-08-18T12:57:47+08:00">
<meta property="article:tag" content="CHS">
<meta property="article:tag" content="ipython">
<meta property="article:tag" content="Machine Learning">
<meta property="article:tag" content="Python">
<meta property="article:tag" content="scikit-learn cookbook">
</head>
<body>
<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>

<!-- Menubar -->

<nav class="navbar navbar-inverse navbar-static-top"><div class="container">
<!-- This keeps the margins nice -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="https://muxuezi.github.io/">

                <span id="blog-title">绿萝间</span>
            </a>
        </div>
<!-- /.navbar-header -->
        <div class="collapse navbar-collapse" id="bs-navbar" aria-expanded="false">
            <ul class="nav navbar-nav">
<li>
<a href="../archive.html">Archive</a>
                </li>
<li>
<a href="../categories/">Tags</a>
                </li>
<li>
<a href="../rss.xml">RSS feed</a>

                
            </li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
    <a href="evaluating-the-linear-regression-model.ipynb" id="sourcelink">Source</a>
    </li>

                
            </ul>
</div>
<!-- /.navbar-collapse -->
    </div>
<!-- /.container -->
</nav><!-- End of Menubar --><div class="container" id="content" role="main">
    <div class="body-content">
        <!--Body content-->
        <div class="row">
            
            
<article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">evaluating-the-linear-regression-model</a></h1>

        <div class="metadata">
            <p class="byline author vcard"><span class="byline-name fn">
                    Tao Junjie
            </span></p>
            <p class="dateline"><a href="#" rel="bookmark"><time class="published dt-published" datetime="2015-08-18T12:57:47+08:00" itemprop="datePublished" title="2015-08-18 12:57">2015-08-18 12:57</time></a></p>
            
        <p class="sourceline"><a href="evaluating-the-linear-regression-model.ipynb" id="sourcelink">Source</a></p>

        </div>
        

    </header><div class="e-content entry-content" itemprop="articleBody text">
    <div tabindex="-1" id="notebook" class="border-box-sizing">
    <div class="container" id="notebook-container">

<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="评估线性回归模型">评估线性回归模型<a class="anchor-link" href="evaluating-the-linear-regression-model.html#%E8%AF%84%E4%BC%B0%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B">¶</a>
</h2>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>在这个主题中，我们将介绍回归模型拟合数据的效果。上一个主题我们拟合了数据，但是并没太关注拟合的效果。每当拟合工作做完之后，我们应该问的第一个问题就是“拟合的效果如何？”本主题将回答这个问题。</p>
<!-- TEASER_END -->
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="Getting-ready">Getting ready<a class="anchor-link" href="evaluating-the-linear-regression-model.html#Getting-ready">¶</a>
</h3>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>我们还用上一主题里的<code>lr</code>对象和<code>boston</code>数据集。<code>lr</code>对象已经拟合过数据，现在有许多方法可以用。</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [1]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">sklearn</span> <span class="k">import</span> <span class="n">datasets</span>
<span class="n">boston</span> <span class="o">=</span> <span class="n">datasets</span><span class="o">.</span><span class="n">load_boston</span><span class="p">()</span>
<span class="kn">from</span> <span class="nn">sklearn.linear_model</span> <span class="k">import</span> <span class="n">LinearRegression</span>
<span class="n">lr</span> <span class="o">=</span> <span class="n">LinearRegression</span><span class="p">()</span>
<span class="n">lr</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">boston</span><span class="o">.</span><span class="n">target</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt output_prompt">Out[1]:</div>


<div class="output_text output_subarea output_execute_result">
<pre>LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)</pre>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [2]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">predictions</span> <span class="o">=</span> <span class="n">lr</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">data</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="How-to-do-it...">How to do it...<a class="anchor-link" href="evaluating-the-linear-regression-model.html#How-to-do-it...">¶</a>
</h3>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>我们可以看到一些简单的量度（metris）和图形。让我们看看上一章的残差图：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [3]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">%</span><span class="k">matplotlib</span> inline
<span class="kn">from</span> <span class="nn">matplotlib</span> <span class="k">import</span> <span class="n">pyplot</span> <span class="k">as</span> <span class="n">plt</span>
<span class="n">f</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="n">f</span><span class="o">.</span><span class="n">tight_layout</span><span class="p">()</span>
<span class="n">ax</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">target</span> <span class="o">-</span> <span class="n">predictions</span><span class="p">,</span><span class="n">bins</span><span class="o">=</span><span class="mi">40</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s1">'Residuals Linear'</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s1">'b'</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=.</span><span class="mi">5</span><span class="p">);</span>
<span class="n">ax</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">"Histogram of Residuals"</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">legend</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="s1">'best'</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt"></div>


<div class="output_png output_subarea ">
<img src="%0AAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XucnVV97/HPL+FOCAGik3CJg1GKoBgsKrUqAwakETEF%0Ay0WgwePLvqwcajznVEE9dFJbAasvU1q02iKmIBfRCsg1OeAIoUKkEsRwiegZDiCZCGQIF0mC+Z0/%0A9pNxMpmZvSeZncma+bxfr/2a57L286xZycx31nqeZ+3ITCRJ0rZt3EhXQJIk1WdgS5JUAANbkqQC%0AGNiSJBXAwJYkqQAGtiRJBTCwNaZFxM8j4t0jXY+RFBF/GhGPR8TzEfHmrXTOcyPiXwfZ3xkR7xmG%0A85wZEXdu6XGkbYGBrVGrv1/6fX+B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/w4osv8olPfIJbbrmF1atX8+Mf/5gZM2Zscuynn36aE088kS984Qs888wzTJ8+%0Anbvuuqtnf72ebktLCzfeeCOrV6/m0ksv5ZOf/CT33XffJuUeeeQRLr74Yu69915Wr17NwoULaW1t%0A3YJWqbn66qtpb29n1apVvO51r+Ozn/0sAC+++CJHH300p59+Or/5zW+46qqr+PjHP85DDz0EwIQJ%0AE7j88st57rnnuPHGG/na177Gddddt9Gx77jjDh5++GFuvfXWLa7nYAxsSRoFMpPZs2czceJEpk2b%0AxvTp0/nc5z4HwOWXX86sWbM49thjAZg5cyaHHXYYN954IxHBuHHjeOCBB/jtb39LS0sLBx100CbH%0Av+mmm3jjG9/ICSecwPjx45k7dy5TpkzZ6PyDmTVrFvvvvz8A7373uznmmGO48847Nyk3fvx41qxZ%0Aw7Jly1i3bh3Tpk3jta997Wa3C9T+mDjhhBM47LDDGD9+PKeddhpLly4F4IYbbmD//fdnzpw5jBs3%0AjhkzZnDCCSf09LKPOOIIDj74YADe9KY3ccopp2w0OgG10YWdd96ZHXfccYvqWY+BLUmjQERw3XXX%0AsXr1ajo6Orj99tu59957AXjssce45ppr2GOPPXped911FytWrGCXXXbh6quv5l/+5V/Ye++9Oe64%0A43jkkUc2Of6vf/1r9t133422DeXO7ptvvpnDDz+cvfbaiz322IObbrqJZ555ZpNyr3vd65g/fz7t%0A7e20tLRw6qmn8tRTTw2xNTbV0tLSs7zzzjvzwgsvALW2ueeeezZqmyuuuIKuri4A7rnnHo488khe%0A/epXM2nSJL7+9a9vUu/hvsN9IAa2JI0y7373uzn77LP59Kc/DcC0adM444wzWLVqVc/r+eef51Of%0A+hQAxxxzDAsXLmTFihUceOCBfPSjH93kmHvvvTePP/54z3pmbrQ+YcIEXnrppZ71FStW9CyvWbOG%0AE088kU996lOsXLmSVatWMWvWrAF75aeeeip33nknjz32GBHR8330Z0tvOps2bRpHHHHEJm1z8cUX%0AA/ChD32I2bNn88QTT9Dd3c3HPvaxnuvyw1WHRhnYkjQKzZ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SVAADW5KkAhjYkiQV4P8D6ozDoP/R7QEAAAAASUVORK5CYII=">
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>如果你用IPython Notebook，就用<code>%matplotlib inline</code>命令在网页中显示matplotlib图形。如果你不用，就用<code>f.savefig('myfig.png')</code>保存图形，以备使用。</p>
<blockquote>
<p>画图的库是<a href="http://matplotlib.org/">matplotlib</a>，并非本书重点，但是可视化效果非常好。</p>
</blockquote>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>和之前介绍的一样，误差项服从均值为0的正态分布。残差就是误差，所以这个图也应噶近似正态分布。看起来拟合挺好的，只是有点偏。我们计算一下残差的均值，应该很接近0：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [4]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">target</span> <span class="o">-</span> <span class="n">predictions</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt output_prompt">Out[4]:</div>


<div class="output_text output_subarea output_execute_result">
<pre>6.0382090193051989e-16</pre>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>另一个值得看的图是<strong>Q-Q图（分位数概率分布）</strong>，我们用Scipy来实现图形，因为它内置这个概率分布图的方法：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [5]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">scipy.stats</span> <span class="k">import</span> <span class="n">probplot</span>
<span class="n">f</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="n">ax</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
<span class="n">probplot</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">target</span> <span class="o">-</span> <span class="n">predictions</span><span class="p">,</span> <span class="n">plot</span><span class="o">=</span><span class="n">ax</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt"></div>


<div class="output_png output_subarea ">
<img src="%0AAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4lOW9//H3lwRIwo6CbLKYuqGoqLXaKmAtqKVq3cWd%0AWE979ICt7c+NWqNVqz1tj+ipXaxhEaW4W82RRWqMVkVRrBuooCKLLCLKmhCS7++P+xlmskFCJpkk%0A83ldV67MPPM8z9wZiZ/cu7k7IiIi6aBNqgsgIiLSVBR6IiKSNhR6IiKSNhR6IiKSNhR6IiKSNhR6%0AIiKSNhR6Io3IzCrMbJ/dvPZTMzuhlteOM7NFVc79bvT4BjO7b/dKXK/yjTCzZY39PiLJpNATqSIK%0AkC1mttHMVpnZJDPrkIKiePRV/QX3F939gCrnxl673d0vBzCzgVHw7tbvupldambl0WfxtZktMLPR%0Au3GfyWb2690pg0gyKfREqnPgB+7eCTgcOBL4ZdWTzCyzqQvWANaAa/8VfRZdgfuBh82sa3KKJdK0%0AFHoiO+HuK4GZwEGwo7nyCjP7CPggOna5mX1k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Nmzdz+eWX13jeru6djlp386aISJIcddRRnHHGGfzo%0ARz/ipz/9KatWreK+++5j7ty5XH/99bTZzYXmn3vuOdydU089lbKyMl588cVKr8+cOZODDz6YM844%0Ag169erFgwQKmT59O//79Of/881m8eDGfffZZjeft6t5SM4WeiKS9efPmMXz4cABWr17NunXruPDC%0AC7n//vu57777yNjNkeAvv/wyhx9+OABDhw7ln//8Z6XXO3XqxE033cSmTZtYuXIlgwYN4uWXX6Zf%0Av34ADBgwgBdffLHW83Z2b6mZQk9E0t78+fMpKSnhT3/6E3fddRezZs2iexIGxq1Zs4acaEGMDh06%0AsGrVqkqvH3fccXTv3p2DDz6YDh060LVrVzp27EhZWRkQmj9XrFhR43m7urfUrOUOZBERSZJ169Zx%0AxhlnADB8+HDatWtXp+vef/995syZU+Nrl1xyCRUVFTtqieXl5dVqjJ9//jnf/va3OfbYY/nVr37F%0AyJEjufDCC3nxxRcZOXIk77zzDvvttx+rVq2qdt6u7i01U+iJSFpbunQpvXr12vH8s88+Y9u2bWRn%0AZ+/y2sGDBzN4J9uQ7bXXXmzevBmADRs20KNHj0qv/+1vf+OGG24gIyODQYMGMWPGDH7+85/z5Zdf%0A8uyzz9K3b18OOugg7rvvvmrn7ereUjOFnoiktXnz5nHooYcCUFpaysqVK8nOzmbNmjX07Nlzp9fu%0ArKZ38cUXc+yxx/L666/z/e9/n9dff50TTjgBgE8//ZSBAwfi7pSWlpKTk8MhhxzC6tWrmT17NsuW%0ALeOyyy7j2Wef5YQTTuC1116rdl6PHj1qvLfsnKYsiEjaKi4u5uabb6Zfv3787ne/o0ePHpx11lmc%0Ac845HHjggQwZMqRB93d3fvGLX3DMMccwf/587rjjDtavX8/o0aN5+eWX+eqrr7jvvvvo3bs3ZsYF%0AF1zAJ598wlNPPUX79u055JBD+M53vlPjeTXdO9216mXIhg+/ifbttzN+/ChGjx6W6iKJiEiKter9%0A9F54IR+AJUsmACj4RERkl1r8lIUlS27jnntqblMXERFJ1OJDD6CkREN1RURk11pF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ARsJLWdHrg4CfA0dGW6VMir0WKY2+l7Pz3+OaAvc9d/92DcdHA8OAUwj7VA5x9/Kd3FukxVGfnkgj%0Ac/e5QI6ZXQQQNVf+nrAP5CeEjS/NzPYGjoou6wRsBjaY2V5AXXaO2BhdlyixpufAB0APMzs6Kktb%0AMxscDbbpH226eR3QBehQ7x9WpJlTTU+kaZwO/NHMbgR6ALOBK6L+s08ItcGFRH1/7v62mS0AFgHL%0AgJdquW9iH+DTwKNmdiowPuH1+Mnh/c4C7o52mM4E/gf4EHggOmbARHffkISfW6RZ0dZCIk0smkt3%0AH3C2uy9MdXlE0olCT0RE0ob69EREJG0o9EREJG0o9EREJG0o9EREJG0o9EREJG0o9EREJG0o9ERE%0AJG38f+BmLBAmYNB0AAAAAElFTkSuQmCC">
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>这个图里面倾斜的数据比之前看的要更清楚一些。</p>
<p>我们还可以观察拟合其他量度，最常用的还有均方误差（mean squared error，MSE），平均绝对误差（mean absolute deviation，MAD）。让我们用Python实现这两个量度。后面我们用scikit-learn内置的量度来评估回归模型的效果：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [6]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">MSE</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">predictions</span><span class="p">):</span>
    <span class="n">squared_deviation</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">power</span><span class="p">(</span><span class="n">target</span> <span class="o">-</span> <span class="n">predictions</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">squared_deviation</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [7]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">MSE</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">target</span><span class="p">,</span> <span class="n">predictions</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt output_prompt">Out[7]:</div>


<div class="output_text output_subarea output_execute_result">
<pre>21.897779217687496</pre>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [8]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="k">def</span> <span class="nf">MAD</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">predictions</span><span class="p">):</span>
    <span class="n">absolute_deviation</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">target</span> <span class="o">-</span> <span class="n">predictions</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">absolute_deviation</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [9]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">MAD</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">target</span><span class="p">,</span> <span class="n">predictions</span><span class="p">)</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt output_prompt">Out[9]:</div>


<div class="output_text output_subarea output_execute_result">
<pre>3.2729446379969396</pre>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h3 id="How-it-works...">How it works...<a class="anchor-link" href="evaluating-the-linear-regression-model.html#How-it-works...">¶</a>
</h3>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>MSE的计算公式是：</p>
$$E(\hat y_t - y_i)^2$$<p>计算预测值与实际值的差，平方之后再求平均值。这其实就是我们寻找最佳相关系数时是目标。高斯－马尔可夫定理（Gauss-Markov theorem）实际上已经证明了线性回归的回归系数的最佳线性无偏估计（BLUE）就是最小均方误差的无偏估计（条件是误差变量不相关，0均值，同方差）。在<strong>用岭回归弥补线性回归的不足</strong>主题中，我们会看到，当我们的相关系数是有偏估计时会发生什么。</p>
<p>MAD是平均绝对误差，计算公式为：</p>
$$E|\hat y_t - y_i|$$<p>线性回归的时候MAD通常不用，但是值得一看。为什么呢？可以看到每个量度的情况，还可以判断哪个量度更重要。例如，用MSE，较大的误差会获得更大的惩罚，因为平方把它放大。</p>

</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h4 id="There's-more...">There's more...<a class="anchor-link" href="evaluating-the-linear-regression-model.html#There's-more...">¶</a>
</h4>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>还有一点需要说明，那就是相关系数是随机变量，因此它们是有分布的。让我们用bootstrapping（重复试验）来看看犯罪率的相关系数的分布情况。bootstrapping是一种学习参数估计不确定性的常用手段：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [15]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">n_bootstraps</span> <span class="o">=</span> <span class="mi">1000</span>
<span class="n">len_boston</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">boston</span><span class="o">.</span><span class="n">target</span><span class="p">)</span>
<span class="n">subsample_size</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">int</span><span class="p">(</span><span class="mf">0.5</span><span class="o">*</span><span class="n">len_boston</span><span class="p">)</span>
<span class="n">subsample</span> <span class="o">=</span> <span class="k">lambda</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">choice</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">len_boston</span><span class="p">),</span><span class="n">size</span><span class="o">=</span><span class="n">subsample_size</span><span class="p">)</span>
<span class="n">coefs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="n">n_bootstraps</span><span class="p">)</span> <span class="c1">#相关系数初始值设为1</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n_bootstraps</span><span class="p">):</span>
    <span class="n">subsample_idx</span> <span class="o">=</span> <span class="n">subsample</span><span class="p">()</span>
    <span class="n">subsample_X</span> <span class="o">=</span> <span class="n">boston</span><span class="o">.</span><span class="n">data</span><span class="p">[</span><span class="n">subsample_idx</span><span class="p">]</span>
    <span class="n">subsample_y</span> <span class="o">=</span> <span class="n">boston</span><span class="o">.</span><span class="n">target</span><span class="p">[</span><span class="n">subsample_idx</span><span class="p">]</span>
    <span class="n">lr</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">subsample_X</span><span class="p">,</span> <span class="n">subsample_y</span><span class="p">)</span>
    <span class="n">coefs</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">lr</span><span class="o">.</span><span class="n">coef_</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
</pre></div>

</div>
</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>我们可以看到这个相关系数的分布直方图：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [18]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">f</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span>
<span class="n">ax</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">add_subplot</span><span class="p">(</span><span class="mi">111</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">hist</span><span class="p">(</span><span class="n">coefs</span><span class="p">,</span> <span class="n">bins</span><span class="o">=</span><span class="mi">50</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s1">'b'</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=.</span><span class="mi">5</span><span class="p">)</span>
<span class="n">ax</span><span class="o">.</span><span class="n">set_title</span><span class="p">(</span><span class="s2">"Histogram of the lr.coef_[0]."</span><span class="p">);</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt"></div>


<div class="output_png output_subarea ">
<img src="%0AAAALEgAACxIB0t1+/AAAG6ZJREFUeJzt3X+QZWdd5/H3xwwhQiBDDDX5iY1AlCggKL9UpFeCG1CT%0ArOsiKJqBSFmyCqMiEtgyPZYLBEXGXdQqfkRG1gQjYCooaAak3YyQtEAmkEwwxK2GBJyJkHQgQpiE%0AfPePeya503371+3b3fP0vF9VU33uc37c79M9fT/3ec65p1NVSJLUom9b7wIkSRqWISZJapYhJklq%0AliEmSWqWISZJapYhJklqliGmVZHk+iQ/ut51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FltK/%0Aj1fVnd3Da4BT17jGlVhK//6j7+GxwIKf0F+LENtSVfu75f3AfL8sbwF+C7hvDWoapSX1L8m3JdnT%0AbfPRqtq7VgWu0FJ/fgAkGaM3Yhn8qfDDz7L614BBNxw4ZQnbtPJCuJT+tWy5/Tsf+OCqVjRaS+pf%0AknOT3Ah8CFjw9MRIrk5MsovelNJsr+t/UFU16HNiSX4SuK2qrk0yPoqaRmml/evW3Qd8f5LjgL9P%0AMl5VkyMvdgij6F93nGOB9wKv7EZkh4VR9a8RS61/9mxHK/1upc5hLbl/Sf4T8FLgh1evnJFbUv+q%0A6nLg8iTPAt4NfPd8244kxKrqufOt606Gn1hV+5KcBNw2YLMfAs5O8nzgGODhSf68qn5xFPWt1Aj6%0A13+sO5P8Lb05+8nRVjqcUfQvyYOA9wH/p/sPeNgY5c+vAV8ETut7fBq9d7sLbXNq19aCpfSvZUvq%0AX3cxx9uBs6qqhWnug5b186uqq5JsSvIdVfWVQdusxXTiFcB53fJ5wJwXuKp6bVWdVlWPBl4I/MPh%0AEmBLsGj/kpxw8Kq3JN8OPBe4ds0qXJml9C/AO4G9VbVjDWsbhUX715hPAI9LMpbkaOBn6fWx3xXA%0AL8L9d9mZ6ZtSPdwtpX8HtXRu/aBF+5fkUcD7gRdX1c3rUONKLKV/j+leU0jyFID5Aoxu5WpfjXI8%0A8GHgJuBKYHPXfjLwtwO2fzZtXZ24aP+AJwKfonclzqeB31rvukfcvx+hdy5zD71wvpbeO8R1r38U%0A/eseX0rvLjTfpDen/5L1rn2BPj2P3hWiNwMXdG2/DPxy3zZv7dZfBzxlvWseZf/oTR3fAtxJ72Kc%0ALwDHrnfdI+zfO4Cv9P2uTa13zSPu36uB67u+XQU8daHj+WFnSVKz1mI6UZKkVWGISZKaZYhJkppl%0AiEmSmmWISZKaZYhJkppliEmSmmWISZKa9f8BuMyB15zUaVEAAAAASUVORK5CYII=">
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>我们还想看看重复试验后的置信区间：</p>

</div>
</div>
</div>
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="prompt input_prompt">In [17]:</div>
<div class="inner_cell">
    <div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">np</span><span class="o">.</span><span class="n">percentile</span><span class="p">(</span><span class="n">coefs</span><span class="p">,</span> <span class="p">[</span><span class="mf">2.5</span><span class="p">,</span> <span class="mf">97.5</span><span class="p">])</span>
</pre></div>

</div>
</div>
</div>

<div class="output_wrapper">
<div class="output">


<div class="output_area">
<div class="prompt output_prompt">Out[17]:</div>


<div class="output_text output_subarea output_execute_result">
<pre>array([-0.18030624,  0.03816062])</pre>
</div>

</div>

</div>
</div>

</div>
<div class="cell border-box-sizing text_cell rendered">
<div class="prompt input_prompt">
</div>
<div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>置信区间的范围表面犯罪率其实不影响房价，因为0在置信区间里面，表面犯罪率可能与房价无关。</p>
<p>值得一提的是，bootstrapping可以获得更好的相关系数估计值，因为使用bootstrapping方法的均值，会比普通估计方法更快地<strong>收敛（converge）</strong>到真实均值。</p>

</div>
</div>
</div>
    </div>
  </div>

    </div>
    <aside class="postpromonav"><nav><ul itemprop="keywords" class="tags">
<li><a class="tag p-category" href="../categories/chs.html" rel="tag">CHS</a></li>
            <li><a class="tag p-category" href="../categories/ipython.html" rel="tag">ipython</a></li>
            <li><a class="tag p-category" href="../categories/machine-learning.html" rel="tag">Machine Learning</a></li>
            <li><a class="tag p-category" href="../categories/python.html" rel="tag">Python</a></li>
            <li><a class="tag p-category" href="../categories/scikit-learn-cookbook.html" rel="tag">scikit-learn cookbook</a></li>
        </ul>
<ul class="pager hidden-print">
<li class="previous">
                <a href="fitting-a-line-through-data.html" rel="prev" title="fitting-a-line-through-data">Previous post</a>
            </li>
            <li class="next">
                <a href="directly-applying-bayesian-ridge-regression.html" rel="next" title="directly-applying-bayesian-ridge-regression">Next post</a>
            </li>
        </ul></nav></aside><script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script><script type="text/x-mathjax-config">
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
        processEscapes: true
    },
    displayAlign: 'center', // Change this to 'center' to center equations.
    "HTML-CSS": {
        styles: {'.MathJax_Display': {"margin": 0}}
    }
});
</script></article>
</div>
        <!--End of body content-->

        <footer id="footer">
            Contents © 2017         <a href="mailto:muxuezi@gmail.com">Tao Junjie</a> - Powered by         <a href="https://getnikola.com" rel="nofollow">Nikola</a>         
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0">
<img alt="Creative Commons License BY-NC-SA" style="border-width:0; margin-bottom:12px;" src="http://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png"></a>
            
        </footer>
</div>
</div>


            <script src="../assets/js/all-nocdn.js"></script><script>$('a.image-reference:not(.islink) img:not(.islink)').parent().colorbox({rel:"gal",maxWidth:"100%",maxHeight:"100%",scalePhotos:true});</script><!-- fancy dates --><script>
    moment.locale("en");
    fancydates(0, "YYYY-MM-DD HH:mm");
    </script><!-- end fancy dates --><script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-51330059-1', 'auto');
  ga('send', 'pageview');

</script>
</body>
</html>
